import throttle from 'lodash.throttle'

//用于echarts图表响应式
export const echartResizeMixins = {
  data(){
    return {
      chart:null
    }
  },
  methods:{

  },
  mounted(){
    //图表大小响应式
    window.addEventListener('resize', throttle(() => {
      if (this.chart) {
        // console.log("重置图表大小")
        this.chart.resize()
      }
    }, 1000))
  },
  beforeDestroy() {
    window.removeEventListener('resize',()=>{})
  }
}
